﻿@model FollowPeers.Models.Jobs
@using FollowPeers.Models;
@{
    ViewBag.Title = "Job Details";
}
@Html.Partial("_Header")
 @{
     FollowPeers.Models.FollowPeersDBEntities followPeersDB = new FollowPeers.Models.FollowPeersDBEntities();
     string name = Membership.GetUser().UserName;
     ViewBag.UserName = name;
     FollowPeers.Models.UserProfile myprofile = followPeersDB.UserProfiles.First(p => p.UserName == name);
}
<div class="container" id="main">
<div class="row">
     @Html.Partial("_SideBar1")
    <div class="span7">
        @Script("jquery.validate.min.js")
        @Script("jquery.validate.unobtrusive.min.js")
        @Script("jquery.bgiframe.js")
        @Script("jquery.mcdropdown.js")
        <link rel="stylesheet" type="text/css" href="../../Content/css/jquery.mcdropdown.css" />
        <link href="../../Content/css/jquery-ui.css" rel="stylesheet" type="text/css" />
                @*-----------JobId-----------*@
                @Html.HiddenFor(model => model.JobId)
                @*-----------OwnerID-----------*@
                @Html.HiddenFor(model => model.ownerID)
            <div class="box" style="border: 1px solid #eee; padding-left:5px;">
             <h3>@Html.DisplayFor(model => model.Title)</h3>
             <h4>@Html.DisplayFor(model => model.Company)   |   @Html.DisplayFor(model => model.Country)</h4></div>
            <hr />
            <h4 style="color:Black">Job Description</h4>
            <div class="display-field">
                @Html.DisplayFor(model => model.Description)
            </div>
            <hr />
             <h4 style="color:Black">Desired Skills and Experience</h4>
            <div class="display-field">
                @Html.DisplayFor(model => model.Requirements)
            </div> 
            <hr />  
            <h4 style="color:Black">Additional Information</h4><br />
            <table>
            <tr><td style="font-weight:bold">Posted:    </td><td>@Html.DisplayFor(model => model.publishDate)</td></tr>
            <tr><td style="font-weight:bold">Type:  </td><td>@Html.DisplayFor(model => model.Type)</td></tr>
            <tr><td style="font-weight:bold">Industry:  </td><td>@Html.DisplayFor(model => model.Industry)</td></tr>
            <tr><td style="font-weight:bold">Job Function:  </td><td>@Html.DisplayFor(model => model.Jobfunction)</td></tr>
            <tr><td style="font-weight:bold">Job ID:    </td><td>@Html.DisplayFor(model => model.JobId)</td></tr>
            </table>  
    </div>
     <div class="span3" style=" text-align:left; border-left: 1px solid #eee; padding-left:10px;">
      <input id="JobId" style="display:none" type="text" value="@Model.JobId" >
    @{
        if (Model.ownerID != myprofile.UserProfileId)
        {
   
         <button class="btn-warning" style="width:150px;">@Html.ActionLink("Apply Now", "AppliedJob", new { id = Model.JobId, Jobname = Model.Title })</button>    
    <br />
    <br />
       @Html.ActionLink("Save Job", "SavedJob", new { id = Model.JobId, Jobname = Model.Title }) 
    <br />             
    @Html.Label("Reccomend Job: ") 
                    <div class="editor-field" id="RecommendList2">
                    <input type="text" id="Recommend2" name="Recommend2" style="width:150px" />&nbsp;<a id="Click2" style="height:50px;"class="icon-hand-right"></a>
                    </div> 
        }
        else
        {
           @Html.ActionLink("Delete Job", "Delete", new { id = Model.JobId })
        <br />
           @Html.ActionLink("Edit Job", "Edit", new { id = Model.JobId })
        <br />
            @Html.ActionLink("Search Job", "Search", new { id = Model.JobId })
        <br />
        @Html.Label("Reccomend Job: ") 
                    <div class="editor-field" id="RecommendList">
                    <input type="text" id="Recommend" name="Recommend" style="width:150px" />&nbsp;<a id="Click1" style="height:50px;"class="icon-hand-right"></a>
                    </div> 
        }
        }
         </div>
</div>
</div>
@Html.Partial("_Footer")
@helper Script(string scriptName)
    {
    <script src="@Url.Content("~/Scripts/" + scriptName)" type="text/javascript"></script>
}

<script type="text/javascript" language="javascript">
    $("#Save_it").click(function () {
        // Get publication ID
        var id1 = $("#JobId").val();
        // Send Ajax Request
        $.ajax({
            type: "POST",
            url: "/Jobs/AppliedJob",
            data: "ID=" + id1,
            success: function () {
                alert('Applied');
            }
        });
    });

    $("#Click2").click(function () {
        var pubId = $("#JobId").val();
        var ID = $("#Recommend2").val();
        $.ajax({
            type: "POST",
            url: "/Jobs/Recommend",
            data: { id: pubId, NameId: ID },
            success: function () {
                alert('Recommendation has been sent to user:');
                window.history.back(-1);
            }
        });
    });


    $("#Click1").click(function () {
        var pubId = $("#JobId").val();
        var ID = $("#Recommend").val();
        $.ajax({
            type: "POST",
            url: "/Jobs/Recommend",
            data: { id: pubId, NameId: ID },
            success: function () {
                alert('Recommendation has been sent');
                window.history.back(-1);
            }
        });
    });

    $("#unbookmark_it").click(function () {
        // Get publication ID
        var id2 = $("#publicationIdAJAX").val();
        // Send Ajax Request
        $.ajax({
            type: "POST",
            url: "/PublicationModel/DeleteBookmark",
            data: "ID=" + id2,
            success: function () {
                alert('Un-Bookmarked');
                window.history.back(-1);
            }
        });
    });

</script>
